var moment = require('moment');

/**
 * 计算日期对应的周一日期
 * @param date
 * @returns {string}
 */
function calcMonday(date) {
    var nowTime = date.getTime();
    var day = date.getDay();
    var oneDayTime = 24 * 60 * 60 * 1000;
    return moment(nowTime - (day - 1) * oneDayTime).format('YYYY-MM-DD');
}

Array.prototype.contains = function (obj) {
    var i = this.length;
    while (i--) {
        if (this[i] == obj) {
            return true;
        }
    }
    return false;
}